﻿using Sidvall.LogManager.UI.ViewModels;
using Sidvall.UI.Views;
using System.Windows;

namespace Sidvall.LogManager.UI.Wpf
{
    public partial class MainWindow : Window
    {
        #region Public Members

        public MainWindowViewModel ViewModel
        {
            get
            {
                return (MainWindowViewModel)this.DataContext;
            }
            set
            {
                this.DataContext = value;
            }
        }

        #endregion
        #region Events

        private async void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            var viewEventArgs = await Sidvall.UI.SystemContext.Current.ConfigurationContext.Regions.NotifyContainerViewsAsync(ViewEventType.ApplicationClosing, Sidvall.UI.Wpf.SystemContext.Current.MainWindow);
            if (viewEventArgs.Cancel)
            {
                e.Cancel = true;
            }
        }

        #endregion
        #region Constructors

        public MainWindow()
        {
            InitializeComponent();

            this.Width = 1174;
            this.Height = 800;
            Sidvall.UI.Wpf.ControlManager.SetLanguage(this);
        }

        #endregion
    }
}
